<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>我的服务</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<include file="public/comm" />
	</head>

	<body>
		<header class="mui-bar mui-bar-nav fs_xl">
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title fs_xl">我的服务</h1>
		</header>
		<include file="public/bottom_nav" />
		</else>
		</if>
		<if $user.is_lock == 1>
		<div class="dongjie">
			<div class="dongjie_img">
				<img src="__STATIC__/images/dongjie.png" />
				<p class="fs_xl">冻结时间：{$user.lock_time|date="Y-m-d H:i:s",###}</p>
			</div>
			<div class="dongjie_info">
				<p class="fs_m">经系统核实，您的账号出现异常操作，为了平台和您的账户安全，平台已经将您的账户进行冻结！如有疑问，请联系平台客服人员，联系方式13086606928;微信号：526895676;QQ：526895676</p>
			</div>
		</div>
		</if>
		<div class="mui-content fs_xl">
		    <div class="user_top fs_xl">
		    	<div class="bg cls">
		    		<div class="user_img fs_xl">
		    			<img class="fs_xl" id="ddd" src="<if empty($user.head_pic)>__STATIC__/images/user_tx.png<else/>{$user.head_pic}</if>" id="image" onclick="$('#doc').click();" />
		    			<input hidden="hidden" type="file" name="file" id="doc" style="width:150px;" onchange="previewImg(this)" />
		    			<div class="star fs_xl">
		    				<div class="deji fs_xl">
		    					<a class="xingji fs_xl" href="#"><img class="fs_xl" src="__STATIC__/images/star0{$stars}.png" /></a>
		    					<a class="vip fs_xl" href="#"><img class="fs_xl" src="__STATIC__/images/vip0{$vip_level}.png" /></a>
		    				</div>
		    			</div>
		    		</div>
		    		<div class="user_id">
		    			<p class="fs_m">昵称：<span>{$user.nickname}</span></p>
		    			<p class="fs_m" style="line-height: initial;">用户ID：<span>{$user['user_id']|sprintf="%09d",###}</span></p>
		    			<p class="user_jjb fs_l"><span class="user_jb_img fs_m"><img src="__STATIC__/images/jb_0001.png" /></span><span class="user_jb fs_xs">{$user.pay_gold}金酒币</span><span class="user_tx fs_m">可提现:<em>￥{$user.pay_gold_TX}</em></span></p>
		    		</div>
		    		<div class="user_yb fs_xl cls">
		    			<a class="yb_lt" href="/Mobile/User/article/id/10.html">
		    				<p class="fs_s">{$user.pay_points}</p>
		    				<p class="fs_s" style="padding-left: 1.8em;">银酒币<span style="padding-left: 0.5em;color: #ccc;" class="fs_xl mui-icon mui-icon-help"></span></p>
		    			</a>
		    			<a class="yb_rt">
		    				<p class="fs_s">{$yesterday_income}</p>
		    				<p class="fs_s" style="padding-left: 1.8em;">昨日收益<span style="padding-left: 0.5em;color: #ccc;" class="fs_xl mui-icon mui-icon-help yjb_sy_gz"></span></p>
		    			</a>
		    			<span class="yb_sx"></span>
		    		</div>
		    		<a href="{:U('/Mobile/User/systemMessage')}" class="xtxx fs_m">
		    			<img src="__STATIC__/images/qiadao_222.png" />
		    			<if condition="$message_count gt 0">
		    				<span class="mui-badge">{$message_count}</span>
		    			</if>
		    	    </a>
		    		<a href="{:U('/Mobile/User/userSign')}" class="qd_tb fs_m"><img src="__STATIC__/images/qiada0.png" /></a>
		    	</div>
		    </div>
		    <div class="my_ord">
		    	<div class="all_ord"><span class="fs_l">我的订单</span><span class="fs_m"><a href="{:U('Mobile/User/order_list')}">查看全部订单></a></span></p>
		    	<div class="all_list">
		    		<a href="{:U('/Mobile/User/order_list',array('type'=>'WAITPAY'))}">
		    			<p class="fs_m" style="position: relative;">
		    				<img src="__STATIC__/images/qianbao.png" />
		    				<span class="mui-badge fs_xs">{$count_sundry_status.wait_pay}</span>
		    			</p>
		    			<p class="fs_xs">待付款</p>
		    		</a>
		    		<a href="{:U('/Mobile/User/order_list',array('type'=>'WAITSEND'))}">
		    			<p class="fs_m" style="position: relative;">
		    				<img src="__STATIC__/images/hezi_01.png" />
		    				<span class="mui-badge fs_xs">{$count_sundry_status.wait_shipping}</span>
		    			</p>
		    			<p class="fs_xs">待发货</p>
		    		</a>
		    		<a href="{:U('/Mobile/User/order_list',array('type'=>'WAITRECEIVE'))}">
		    			<p class="fs_m" style="position: relative;">
		    				<img src="__STATIC__/images/car.png" />
		    				<span class="mui-badge fs_xs">{$count_sundry_status.wait_receive}</span>
		    			</p>
		    			<p class="fs_xs">待收货</p>
		    		</a>
		    		<a href="{:U('/Mobile/User/order_list',array('type'=>'WAITCCOMMENT'))}">
		    			<p class="fs_m" style="position: relative;">
		    				<img src="__STATIC__/images/news.png" />
		    				<span class="mui-badge fs_xs">{$count_sundry_status.wait_comment}</span>
		    			</p>
		    			<p class="fs_xs">待评价</p>
		    		</a>
		    		<a href="{:U('/Mobile/User/return_goods_list')}">
		    			<p class="fs_m"><img src="__STATIC__/images/rmb_01.png" /></p>
		    			<p class="fs_xs">售后</p>
		    		</a>
		    	</div>
		    </div>
		</div>
			<div class="person fs_xl">
				<div class="per_tit fs_l">个人中心</div>
				<div class="per_list cls">
					<a href="{:U('Mobile/User/userinfo2')}">
						<p class="fs_l"><img src="__STATIC__/images/book.png" /></p>
						<p class="fs_xs">基本资料</p>
					</a>
					<a href="{:U('Mobile/User/distribut_qr')}">
						<p class="fs_l"><img src="__STATIC__/images/share.png" /></p>
						<p class="fs_xs">推广</p>
					</a>
					<a href="{:U('Mobile/User/cellar_list')}">
						<p class="fs_l"><img src="__STATIC__/images/tanzi_01.png" /></p>
						<p class="fs_xs">藏酒</p>
					</a>
					<a href="{:U('Mobile/User/destine_list')}">
						<p class="fs_l"><img src="__STATIC__/images/pz_01.png" /></p>
						<p class="fs_xs">定制</p>
					</a>
					<a href="{:U('Mobile/User/wallet')}">
						<p class="fs_l"><img src="__STATIC__/images/qiandai.png" /></p>
						<p class="fs_xs">我的钱包</p>
					</a>
					<a href="{:U('Mobile/User/activity')}">
						<p class="fs_l"><img src="__STATIC__/images/hezi.png" /></p>
						<p class="fs_xs">我的活动</p>
					</a>
					<!--<a href="{:U('Mobile/User/indiana')}">
						<p class="fs_l"><img src="__STATIC__/images/yuanbao.png" /></p>
						<p class="fs_xs">我的夺宝</p>
					</a>-->
					<a href="{:U('Mobile/Station/index')}">
						<p class="fs_l"><img src="__STATIC__/images/julebu.png" /></p>
						<p class="fs_xs">俱乐部</p>
					</a>
					<a href="{:U('Mobile/exchange/exchange_record')}">
						<p class="fs_l"><img src="__STATIC__/images/duihuan03.png" /></p>
						<p class="fs_xs">我的兑换</p>
					</a>
					<!--<a href="{:U('Mobile/index/dial')}">
						<p class="fs_l"><img src="__STATIC__/images/choujiang01.png" /></p>
						<p class="fs_xs">转盘抽奖</p>
					</a>-->
					<a href="{:U('Mobile/User/day_task')}">
						<p class="fs_l"><img src="__STATIC__/images/guali.png" /></p>
						<p class="fs_xs">我的任务</p>
					</a>
					<a href="{:U('Mobile/User/coupon')}">
						<p class="fs_l"><img src="__STATIC__/images/bank.png" /></p>
						<p class="fs_xs">优惠券</p>
					</a>
					<a href="{:U('Mobile/User/help')}">
						<p class="fs_l"><img src="__STATIC__/images/help.png" /></p>
						<p class="fs_xs">帮助中心</p>
					</a>
					<a href="{:U('Mobile/User/service')}">
						<p class="fs_l"><img src="__STATIC__/images/phone.png" /></p>
						<p class="fs_xs">客服热线</p>
					</a>
					<a href="{:U('Mobile/User/notice')}">
						<p class="fs_l"><img src="__STATIC__/images/laba.png" /></p>
						<p class="fs_xs">平台公告</p>
					</a>
				</div>
			</div>
		<script type="text/javascript">
			$(function(){
//				$(".yjb_gz").click(function(){
//					var ur=$(this).attr("href");
//					location.href=ur;
//				});
//				$(".yb_lt span").click(function(){
//					location.href="/Mobile/User/article/id/10.html";
//				});
//				$(".yb_rt span").click(function(){
//					location.href="/Mobile/User/article/id/10.html";
//				})
				
			})
			$(".all_list a").each(function(){
				var nui=$(this).find("span").text();
				if(nui==0){
					$(this).find("span").hide();
				}
			})
			
			var bW=$("body").width();
			$(".per_list a").width((bW-3)/4);
//			var image = '';
//			function selectImage(file) {
//				if(!file.files || !file.files[0]) {
//					return;
//				}
//				var reader = new FileReader();
//				reader.onload = function(evt) {
//					$.ajax({
//						type:"POST",
//						url:"/Mobile/User/updheadPic",
//						data:{"imgsrc":evt.target.result},
//						dataType:"json",
//						async:false,//同步操作
//						success:function(date){
//							if(date.status == 1){
//								document.getElementById('image').src = evt.target.result;
//								image = evt.target.result;
//							}else{
//								alert(date.msg);
//								return false;
//							}
//						}
//					});
//				}
//				reader.readAsDataURL(file.files[0]);
//			}
			function previewImg(input) {
				if(input.files && input.files[0]) {
					var reader = new FileReader(),
						img = new Image();
					reader.onload = function(e) {
						var imgsrc=document.getElementById('ddd').src;
						if(input.files[0].size > 307200) { //图片大于300kb则压缩
							img.src = e.target.result;
							img.onload = function() {
								imgsrc = compress(img);
								$.ajax({
									type:"POST",
									url:"/Mobile/User/updheadPic",
									data:{"imgsrc":imgsrc},
									dataType:"json",
									async:false,//同步操作
									success:function(date){
										if(date.status == 1){
											document.getElementById('ddd').src = imgsrc;
										}else{
											alert(date.msg);
											return false;
										}
									}
								});
							}
						}else{
							imgsrc = e.target.result;
							$.ajax({
								type:"POST",
								url:"/Mobile/User/updheadPic",
								data:{"imgsrc":imgsrc},
								dataType:"json",
								async:false,//同步操作
								success:function(date){
									if(date.status == 1){
										document.getElementById('ddd').src = imgsrc;
									}else{
										alert(date.msg);
										return false;
									}
								}
							});
						}
					}
					reader.readAsDataURL(input.files[0]);
					return 1;
				}
			}
			//压缩图片函数
			function compress(img) {
				var initSize = img.src.length;
				var width = img.width;
				var height = img.height;
				var canvas = document.createElement("canvas");
				var ctx = canvas.getContext('2d');
				//如果图片大于四百万像素，计算压缩比并将大小压至400万以下
				var ratio;
				if((ratio = width * height / 4000000) > 1) {
					ratio = Math.sqrt(ratio);
					width /= ratio;
					height /= ratio;
				} else {
					ratio = 1;
				}
				canvas.width = width;
				canvas.height = height;
				//铺底色
				ctx.fillStyle = "#fff";
				ctx.fillRect(0, 0, canvas.width, canvas.height);
				ctx.drawImage(img, 0, 0, width, height);
				//进行最小压缩
				var ndata = canvas.toDataURL("image/jpeg",0.4);
//				console.log(ndata.length)
				canvas.width = canvas.height = 0;
				return ndata;
			}
		</script>
		<script type="text/javascript">
			$(function() {
				var u = navigator.userAgent,
					app = navigator.appVersion;
				var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //g
				var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
				if(isAndroid) {
					$("#doc").attr("accept","image/*");
					$("#doc").attr("capture","camera");
				}
				if(isIOS) {
					return false;
				}
			});
		</script>
	</body>

</html>